

  import { mapGetters } from 'vuex'
  
  export default {
    computed:{
      ...mapGetters('m_cart', ['total'])
    },
    watch: {
      total(){
        // 设置徽标
        this.setBadge()
      }
    },
    onShow() {
      // 设置tabbar徽标
      this.setBadge()
    },
    methods: {
      setBadge(){
        if(this.total > 0){
          uni.setTabBarBadge({
            index: 2,
            text: this.total+''
          })
        }

      }
    }
  }